<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">大额用户明细表(公众号)</ui:define>
    <ui:define name="content">
        <h:form>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"/>
                        <p:columnToggler datasource="userapplylist" trigger="toggler"/>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         update="@form"/>
                        <p:commandButton value="重置" icon="fa fa-refresh"
                                         actionListener="#{loanLargeAmountGzhBean.onReset}"
                                         process="@this"
                                         update="@form"/>
                        <p:commandButton value="导出" icon="fa fa-download"
                                         ajax="false">
                            <p:dataExporter type="xls" target="userapplylist" fileName="userApplyDetail"/>
                        </p:commandButton>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card ui-g-12">
                            <div class="ui-g-12">
                                <h3>查询条件</h3>
                            </div>
                            <div class="ui-g-1 ui-sm-3">
                                <p:outputLabel for="startDate" value="开始日期"/>
                            </div>
                            <div class="ui-g-3 ui-sm-3">
                                <p:calendar
                                        id="startDate" styleClass="autoWidthCalendar"
                                        value="#{loanLargeAmountGzhBean.$.startDate}"
                                        locale="#{constants:get('LOCALE')}"
                                        timeZone="#{constants:get('TIME_ZONE')}"
                                        pattern="#{constants:get('DATE_FORMAT')}"/>
                            </div>
                            <div class="ui-g-1 ui-sm-3">
                                <p:outputLabel value="结束日期"/>
                            </div>
                            <div class="ui-g-3 ui-sm-3">
                                <p:calendar
                                        id="endDate" styleClass="autoWidthCalendar"
                                        value="#{loanLargeAmountGzhBean.$.endDate}"
                                        locale="#{constants:get('LOCALE')}"
                                        timeZone="#{constants:get('TIME_ZONE')}"
                                        pattern="#{constants:get('DATE_FORMAT')}"/>
                            </div>

                            <div class="ui-g-1 ui-sm-3">
                                <p:outputLabel value="申请额度"/>
                            </div>
                            <div class="ui-g-3 ui-sm-3">
                                <p:inputNumber decimalPlaces="0" value="#{loanLargeAmountGzhBean.$.loanAmount}"/>
                            </div>

                            <div class="ui-g-1 ui-sm-3">
                                <p:outputLabel value="用户类型"/>
                            </div>
                            <div class="ui-g-3 ui-sm-3">
                                <p:selectOneMenu value="#{loanLargeAmountGzhBean.$.userType}">
                                    <f:selectItem itemLabel="全部" itemValue=""/>
                                    <f:selectItem itemLabel="三无用户" itemValue="0" />
                                    <f:selectItem itemLabel="网贷用户" itemValue="1" />
                                    <f:selectItem itemLabel="小贷用户" itemValue="2" />
                                    <f:selectItem itemLabel="银行用户" itemValue="3" />
                                </p:selectOneMenu>
                            </div>

                            <div class="ui-g-1 ui-sm-3">
                                <p:outputLabel value="所在地区"/>
                            </div>
                            <div class="ui-g-3 ui-sm-3">
                                <p:inputText value="#{loanLargeAmountGzhBean.$.workCity}"/>
                            </div>

                            <div class="ui-g-1 ui-sm-3">
                                <p:outputLabel value="是否有返佣劵"/>
                            </div>
                            <div class="ui-g-3 ui-sm-3">
                                <p:selectOneMenu value="#{loanLargeAmountGzhBean.$.hasBackSecurities}">
                                    <f:selectItem itemLabel="全部" itemValue=""/>
                                    <f:selectItem itemLabel="无" itemValue="0" />
                                    <f:selectItem itemLabel="有" itemValue="1" />
                                </p:selectOneMenu>
                            </div>

                            <div class="ui-g-1 ui-sm-3">
                                <p:outputLabel value="是否有红包"/>
                            </div>
                            <div class="ui-g-3 ui-sm-3">
                                <p:selectOneMenu value="#{loanLargeAmountGzhBean.$.hasRedPacket}">
                                    <f:selectItem itemLabel="全部" itemValue=""/>
                                    <f:selectItem itemLabel="无" itemValue="0" />
                                    <f:selectItem itemLabel="有" itemValue="1" />
                                </p:selectOneMenu>
                            </div>

                        </div>
                        <div class="card">
                            <p:dataTable id="userapplylist"
                                         style="width: 100%"
                                         var="userApplyInfo"
                                         value="#{loanLargeAmountGzhBean.lazyDataModel}"
                                         rows="#{constants:get('ROWS')}"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         reflow="true"
                                         resizableColumns="true">

                                <p:column headerText="操作" exportable="false">
                                    <p:splitButton icon="fa fa-eye"
                                                   action="#{loanLargeAmountGzhBean.onView(userApplyInfo.id)}"
                                                   process="@this">
                                        <f:setPropertyActionListener value="/views/family/WholeSaleManage/large-amount-gzh-list.xhtml"
                                                                     target="#{currentUserBean.back}"/>
                                    </p:splitButton>
                                </p:column>

                                <p:column headerText="姓名">
                                    <h:outputText value="#{userApplyInfo.name}"/>
                                </p:column>
                                <p:column headerText="手机">
                                    <h:outputText value="#{userApplyInfo.mobNum}"/>
                                </p:column>
                                <p:column headerText="所在地区">
                                    <h:outputText value="#{userApplyInfo.workCity}"/>
                                </p:column>
                                <p:column headerText="用户类型">
                                    <h:outputText value="#{userApplyInfo.userType}"/>
                                </p:column>
                                <p:column headerText="申请额度">
                                    <h:outputText value="#{userApplyInfo.loanAmount == null ? 0 : userApplyInfo.loanAmount}万"/>
                                </p:column>
                                <p:column headerText="借贷次数">
                                    <h:outputText value="#{userApplyInfo.loanCount}"/>
                                </p:column>
                                <p:column headerText="申请次数">
                                    <h:outputText value="#{userApplyInfo.appplyCount}"/>
                                </p:column>
                                <p:column headerText="申请时间">
                                    <h:outputText value="#{userApplyInfo.applyTime}"/>
                                </p:column>
                                <p:column headerText="是否有红包">
                                    <h:outputText value="#{userApplyInfo.hasRedPacket == 1 ? '有':'无'}"/>
                                </p:column>
                                <p:column headerText="红包获取时间">
                                    <h:outputText value="#{userApplyInfo.getRedPacketTime}"/>
                                </p:column>
                                <p:column headerText="是否有返佣劵">
                                    <h:outputText value="#{userApplyInfo.hasBackSecurities == 1 ? '有':'无'}"/>
                                </p:column>
                                <p:column headerText="返佣劵获取时间">
                                    <h:outputText value="#{userApplyInfo.getBackSecuritiesTime}"/>
                                </p:column>

                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
